﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WiseLinkWPF.Windows.Controls.GridView;
using WiseLinkWPF.Windows.Controls;
using CCF20Model;
using System.Collections;
using System.Data;
namespace CCF20
{
    /// <summary>
    /// Interaction logic for VehicleMessage.xaml
    /// </summary>
    public partial class RegistrationStats : UserControl
    {
        StatsModel statsModel;
        


        public RegistrationStats()
        {
            InitializeComponent();
            statsModel = new StatsModel();
            
        }

        
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.gridDayStats.ItemsSource = statsModel.GetDailyStats();
            this.gridCareSumStats.ItemsSource = statsModel.GetCareSumStats();
            this.gridStats.ItemsSource = statsModel.GetDeclineStats();
            
        }

        private void gridCareSumStats_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            if (e.AddedItems.FirstOrDefault() != null)
            {
                CareSumStats sumData = e.AddedItems.FirstOrDefault() as CareSumStats;
                this.gridCareStats.ItemsSource = statsModel.GetCareStats(sumData.MyMonth);

            }
        }

      
    }
}
